import { storage } from './storage';

const UserKey = 'user';
const tokenKey = 'token'

export function setUser(user) {
  return storage.setItem(UserKey, JSON.stringify(user));
}

export function getUser() {
  if(storage.getItem(UserKey) != undefined) {
    return JSON.parse(storage.getItem(UserKey));
  }
  return null;
}

export function removeUser() {
  return storage.removeItem(UserKey);
}

export function setToken(token) {
  return storage.setItem(tokenKey, token);
}

export function getToken() {
  return storage.getItem(tokenKey);
}

export function removeToken() {
  return storage.removeItem(tokenKey);
}


